define([],function() {   
	'use strict';     	
	var WebPDF = angular.module('WebPDF', ['ngResource']);
	WebPDF.config(['$controllerProvider',
		'$compileProvider', '$filterProvider', '$provide', '$httpProvider',
		function(routeResolverProvider, $controllerProvider,
			$compileProvider, $filterProvider, $provide, $httpProvider) {

			//Change default views and controllers directory using the following:
			//routeResolverProvider.routeConfig.setBaseDirectories('/app/views', '/app/controllers');
			WebPDF.register = {
				controller: $controllerProvider.register,
				directive: $compileProvider.directive,
				filter: $filterProvider.register,
				factory: $provide.factory,
				service: $provide.service
			};
		}
	]);	

	WebPDF.run(function() {
		var dnmmy = $("body");
            
		WebPDF.DocumentLoadFinished = function(callback) {
			if (typeof callback == "function") {
				dnmmy.bind("DocumentLoadFinished", callback);
			} else {
				dnmmy.trigger("DocumentLoadFinished", [callback]);
			}
		};

		WebPDF.PageContainerCreated = function(callback) {
			if (typeof callback == "function") {
				dnmmy.bind("PageContainerCreated", callback);
			} else {
				dnmmy.trigger("PageContainerCreated", [callback]);
			}
		};

		WebPDF.PageShowCompleted = function(callback) {
			if (typeof callback == "function") {
				dnmmy.bind("PageShowCompleted", callback);
			} else {
				dnmmy.trigger("PageShowCompleted", [callback]);
			}
		};		
	});
	return WebPDF;
});